package com.gopay.common.constants.gsrt;
/**
 * G商融通标的常量
 * @author zyt
 *
 */
public class BidConstants {

	/**
	 * 下面三种是最早的，G商融通内部的状态，
	 * 截至2016-04-27，只有01，02可用
	 */
	/**
	 * 标的状态，01：募集中
	 */
	public static final String BID_STATE_RAISING = "01";
	/**
	 * 标的状态，02：还款中
	 */
	public static final String BID_STATE_REPAYING = "02";
	/**
	 * 标的状态，03：已结束
	 */
	public static final String BID_STATE_FINISHED = "03";
	
	
	
	
	
	
	
	
	
	
	/**
	 * 恒丰银行  募集中 01：
	 */
	public static final String HF_BID_STATE_01 = "01";
	/**
	 * 恒丰银行 还款中 02;
	 */
	public static final String HF_BID_STATE_02 = "02";
	/**
	 * 恒丰银行    银行审核中： 03
	 */
	public static final String HF_BID_STATE_03 = "03";
	/**
	 *恒丰银行  已到期未结清  04
	 */
	public static final String HF_BID_STATE_04 = "04";
	/**
	 * 恒丰银行  已结清 :05
	 */
	public static final String HF_BID_STATE_05 = "05";
	
	

	/**
	 * 恒丰银行 P-审核通过
	 */
	public static final String HF_BANK_STATE_P = "P";
	/**
	 * 恒丰银行 R-审核拒绝
	 */
	public static final String HF_BANK_STATE_R = "R";
	/**
	 * 恒丰银行 S-待审核
	 */
	public static final String HF_BANK_STATE_S = "S";
	/**
	 * 恒丰银行 F-附件已上传
	 */
	public static final String HF_BANK_STATE_F = "F";
	/**
	 * 恒丰银行  银行审核中 
	 * 
	 */
	public static final String HF_BANK_STATE_B = "B";
	
	/**
     * 获取银行审核状态转换后的文字
     */
    public static String getHfBankState(String hfBankState) {
        String bankState = "";

        if (BidConstants.HF_BANK_STATE_P.equals(hfBankState)) {
            bankState = "审核通过";
        } else if (BidConstants.HF_BANK_STATE_R.equals(hfBankState)) {
            bankState = "审核拒绝";
        } else if (BidConstants.HF_BANK_STATE_S.equals(hfBankState)) {
            bankState = "待审核";
        } else if (BidConstants.HF_BANK_STATE_F.equals(hfBankState)) {
            bankState = "附件已上传";
        } else if (BidConstants.HF_BANK_STATE_B.equals(hfBankState)) {
        	bankState = "银行审核中";
        } else {
            bankState = "未知";
        }

        return bankState;

    }

    /**
     * 获取交易状态转换后的文字
     */
    public static String getStatusTransResult(String str) {
        String result = "";

        if (BidConstants.HF_BID_STATE_01.equals(str)) {
            result = "募集中";
        } else if (BidConstants.HF_BID_STATE_02.equals(str)) {
            result = "还款中 ";
        } else if (BidConstants.HF_BID_STATE_03.equals(str)) {
            result = "银行审核中";
        } else if (BidConstants.HF_BID_STATE_04.equals(str)) {
            result = "已到期未结清";
        } else if (BidConstants.HF_BID_STATE_05.equals(str)) {
            result = "已结束";
        } else {
            result = "未知";
        }

        return result;
    }

	/**
	 * 通过恒丰银行审核状态获取对应的标的状态
	 * @param bankState
	 * @return
     */
	public static String getBidStateByHfBankState(String bankState) {
		String result = "";
		if (HF_BANK_STATE_P.equals(bankState)) {
			result = HF_BID_STATE_01;
		} else if (HF_BANK_STATE_R.equals(bankState)) {
			result = HF_BID_STATE_05;
		} else if (HF_BANK_STATE_S.equals(bankState) || HF_BANK_STATE_F.equals(bankState)) {
			result = HF_BID_STATE_03;
		}
		return result;
	}
	
	/**
	 * 散标
	 */
	public static final String SAN_BIAO = "01";
	/**
	 * 众筹
	 */
	public static final String CROWD_FUNDING  = "02";
	/**
	 * 翻译标的类型
	 * @param param
	 * @return
	 */
	public static String transBidType(String param){
		String bidType = "未知";
		if(SAN_BIAO.equals(param)){
			bidType = "散标";
		}else if(CROWD_FUNDING.equals(param)){
			bidType = "众筹";
		}else{
			bidType = "未知";
		}
		return bidType;
	}
	
	
	/**
	 * 一次性还本付息
	 */
	public static final String ONE_TIME  = "01";
	/**
	 * 先息后本
	 */
	public static final String XXHB  = "02";
	/**
	 * 等额本息
	 */
	public static final String DEBX  = "03";
	/**
	 * 等额本金
	 */
	public static final String DEBJ  = "04";
	/**
	 * 众筹无还款
	 */
	public static final String ZCWHK  = "05";
	/**
	 * 其它
	 */
	public static final String OTHER  = "06";
	/**
	 * 翻译还款方式
	 * @param param
	 * @return
	 */
	public static String transRepayType(String param){
		String repayType = "未知";
		if(ONE_TIME.equals(param)){
			repayType = "一次性还本付息";
		}else if(XXHB.equals(param)){
			repayType = "先息后本";
		}else if(DEBX.equals(param)){
			repayType = "等额本息";
		}else if(DEBJ.equals(param)){
			repayType = "等额本金";
		}else if(ZCWHK.equals(param)){
			repayType = "众筹无还款";
		}else if(OTHER.equals(param)){
			repayType = "其他";
		}else{
			repayType = "未知";
		}
		return repayType;
	} 
}
